﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SystemOperationLog.aspx.cs" Inherits="ZLDC.Estate.TM.SystemOperationLog" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>系统操作日志</title>
    <link href="../css/main.css" rel="stylesheet" type="text/css" />
    <link href="../js/jquery/style/jquery.hiAlerts.css" rel="stylesheet" type="text/css" />
    <link href="../js/jquery.autocomplete/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
    <link href="../js/jquery/style/jquery.simple.tree.css" rel="stylesheet" type="text/css" />
   
    
    
    <script src="../js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    
    <script src="../js/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>

    <script src="../js/jquery/jquery.hiAlerts-min.js" type="text/javascript"></script>    
    

</head>
<body>
    <div id="divSearch" style="margin-top: 5px; text-align: center;">
        <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#a8c7ce">
            <tr>
                <td style="width: 15%; text-align: left; background-color: #FFFFFF; cursor: pointer;"
                    valign="middle">
                    类型：
                    <select id="sType" name="sType" style="width: 60px;">
                        <option value="0">全部</option>
                        <option value="1">系统登录</option>
                        <option value="2">楼盘字典</option>
                        <option value="3">盘源管理</option>
                        <option value="4">客源管理</option>
                    </select>             
                </td>
               
                <td style="width: 35%; text-align: left; background-color: #FFFFFF; cursor: pointer;"
                    valign="middle">
                    <span id="spanDate">日期: <input id="iStartDay" name="iStartDay" onclick="WdatePicker()" style="width:80px;" />
                        ~
                        <input id="iEndDay" name="iEndDay" onclick="WdatePicker()" style="width:80px;" />
                        小时：
                        
                     
                    <select id="Shour1" runat="server" name="Shour1">
                    
                    </select>~<select runat="server" id="Shour2" name="Shour2">
                        
                    </select></span></td>
                <td style="text-align: left; background-color: #FFFFFF; cursor: pointer;" valign="middle">
                    
                    &nbsp;部门<a href="#" id="selDept" onclick="javascript:showDept('dvDept')">↓</a>
                    <div id="dvDept" style="overflow: auto; z-index: 2000; position: absolute; display: none;
                        border: 1px; border-style: outset; background-color: #ffffff; height: 145px;
                        width: 200px; text-align: left;">
                        <asp:Literal ID="ltlDeptTree" runat="server"></asp:Literal>
                    </div>
                    <input id="umainclass" title='拼音首字母提示' style="width: 70px" name="umainclass" onblur="selDU()" />
                    <input id="utxtmain" runat="server" style="display: none;" />
                
                     人员:<input id="usubclass" title='拼音首字母提示,格式:姓名[工号,部门]' style="width: 70px" name="umainclass"
                        onblur="selDU()" />
                       <input id="utxtsub" name="utxtsub" runat="server" style="display: none;" />
                        
                    
                 <input id="btnSearch" class="button_bak" type="button" value="查询" onclick="return search()" />
                </td>
            </tr>
        </table>
    </div>
    <div id="divHead" style="margin-top: 2px; margin-bottom: 2px;">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td height="24" bgcolor="#353c44">
                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td>
                                <img src="../images/tb.gif" width="14" height="14" /><span class="STYLE1">系统操作日志列表</span>
                            </td>
                            <td>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    <div id="divList">
    </div>
    <div id="divPage">
    </div>

    <input id="utxdeptid" name="utxdeptid" runat="server" type="hidden" />


    <script src="../js/LexunJS.js" type="text/javascript"></script>

    <script src="../js/jquery.autocomplete/jquery.autocomplete.min.js" type="text/javascript"></script>

    <script src="../js/jquery/jquery.simple.tree.js" type="text/javascript"></script>

    <script src="../js/DeptTree.js" type="text/javascript"></script>


    <script type="text/javascript" language="javascript">
        var currentPage = 1; // 当前页
        var pageSize = 10; // 每页显示多少条
        var pageall = 0; // 总页数
        var total = 0; // 总记录数

        // 读取列表
        $(function() {
            showList(currentPage);
        });

        // 条件查询列表
        function showList(currentPage) {
        
            var typeid = $("#sType").val();                         //  日志类型 1系统登录 2楼盘字典 3盘源管理 4客源管理            
            var startdate = $("#iStartDay").val();
            var enddate = $("#iEndDay").val();
          
            var hour1 = $("#Shour1").val();
            var hour2 = $("#Shour2").val();

            var deptid = document.getElementById("utxdeptid").value;
            var userName = document.getElementById("utxtsub").value;


            if (startdate != "") {
                if (hour1 != "请选择" && hour1 != null && hour1 != "") {
                    startdate = startdate + " " + hour1 + ":00:00";
                } else {
                    startdate = startdate + " 00:00:00";
                }
            }

            if (enddate != "") {
                if (hour2 != "请选择" && hour2 != null && hour2 != "") {
                    enddate = enddate + " " + hour2 + ":59:59";
                } else {
                    enddate = enddate + " 23:59:59";
                }
            }

            

            $("#divList").html("<img src=\"../images/loading.gif\" />"); // 清空列表 
            $.ajax({
                type: 'POST',
                url: '../Handler/HandlerSystem.ashx',
                data: 'act=operationlog_list&page=' + currentPage + '&pagesize=' + pageSize + "&typeid=" + typeid + "&startdate=" + startdate + "&enddate=" + enddate + "&name=" + userName+"&deptid="+deptid,
                timeout: '10000',
                error: function() {
                    alert("系统繁忙,请稍候后试！");
                }, success: function(json) {
                    listCallBack(json);
                }
            });
        }

        /*
        功能: 将返回的json数据进行排版
        json: json数据
        */

        function listCallBack(response) {
            var json = eval("(" + response + ")");
            var record = json.record;

            if (record == null || record.length == 0) {
                $("#divList").html("<font color='red'>&nbsp;系统内暂无您查询的信息!</font>");
                return;
            }

            var page = json.page;

            currentPage = page.currentpage;
            pageall = parseInt(page.pageall);
            total = page.total;

            var arr = [];
            arr.push("<table id='table1' width='100%' border='0' cellpadding='0' cellspacing='1' bgcolor='#a8c7ce'>");
            arr.push("<tr>");
            arr.push("<td height='25' bgcolor='d3eaef' class='STYLE6'>");
            arr.push("序号");
            arr.push("</td>");
            arr.push("<td height='25' bgcolor='d3eaef' class='STYLE6'>");
            arr.push("操作人");
            arr.push("</td>");
            arr.push("<td height='25' bgcolor='d3eaef' class='STYLE6'>");
            arr.push("操作内容");
            arr.push("</td>");     
            arr.push("<td height='25' bgcolor='d3eaef' class='STYLE6'>");
            arr.push("IP地址");
            arr.push("</td>");
            arr.push("<td height='25' bgcolor='d3eaef' class='STYLE6'>");
            arr.push("操作时间");
            arr.push("</td>");                  
            arr.push("</tr>");

            var stateName = ""; // 状态
            var recordLength = record.length;
            for (var i = 0; i < recordLength; i++) {               
                if (i % 2 == 0)
                    arr.push("<tr bgcolor='#FFFFFF'>");
                else
                    arr.push("<tr bgcolor='#EEEDED'>"); 
                                            
                arr.push("<td height='20' class='STYLE6'>");
                arr.push(record[i].id);
                arr.push("</td>");
                arr.push("<td height='20' class='STYLE6'>");
                arr.push(record[i].operateuser);
                arr.push("</td>");
                arr.push("<td height='20' class='STYLE6'>");
                arr.push(record[i].content);
                arr.push("</td>");
                arr.push("<td height='20' class='STYLE6'>");
                arr.push(record[i].ip);
                arr.push("</td>");
                arr.push("<td height='20' class='STYLE6'>");
                arr.push(record[i].operatedate);
                arr.push("</td>");                                    
                arr.push("</tr>");
            }
            arr.push("</table>");
            $("#divList").html(arr.join('')); // 显示列表

            $("#divPage").html(""); // 清空
            if (pageall > 1) {
                var pageHtml = LexunJS.showPage(currentPage, pageall, "showList"); // 分页
                $("#divPage").html(pageHtml);
            }
        }

        // 响应键盘查询
        function responseEnter(e) {
            var key = window.event ? e.keyCode : e.which;
            if (key == 13)
                search();
        }

        // 条件查询
        function search() {
            $("#divList").html(""); // 清空列表        
            $("#divPage").html(""); // 清空分页
            showList(1);
        }

       
       
    </script>

</body>
</html>
